package com.lupan.classicsJava.jpa.domain;

import javax.persistence.*;

/**
 * 说明：学生
 *
 * @author lupan
 * @version 2016/8/25 18:00
 */
@Entity
@Table(name="STUDENT")
public class Student extends BaseEntity{

    @Column(nullable = false)
    private String name;

    @Column(nullable = false,unique = true)
    private String num;

    @OneToOne(targetEntity = SchoolCard.class)
    @JoinColumn(name="schoolCardId")
    private SchoolCard schoolCard;

    /**
     * 班主任
     * ManyToOne双向关联应该由many的一段管理关联关系
     */
    @ManyToOne(targetEntity = Teacher.class)
    @JoinColumn(name="teacherId")
    private Teacher teacher;

    @ManyToOne(targetEntity = Class.class)
    @JoinColumn(name="classId")
    private Class clazz;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getNum() {
        return num;
    }

    public void setNum(String num) {
        this.num = num;
    }

    public SchoolCard getSchoolCard() {
        return schoolCard;
    }

    public void setSchoolCard(SchoolCard schoolCard) {
        this.schoolCard = schoolCard;
    }

    public Teacher getTeacher() {
        return teacher;
    }

    public void setTeacher(Teacher teacher) {
        this.teacher = teacher;
    }

    public Class getClazz() {
        return clazz;
    }

    public void setClazz(Class clazz) {
        this.clazz = clazz;
    }
}
